<template>
  <keep-alive :include="cacheList" :exclude="notCacheName[0] !== '' ? notCacheName : refreshName">
    <router-view v-if="!refresh" ref="child"/>
  </keep-alive>
</template>
<script>
export default {
  name: 'ParentView',
  computed: {
    tagNavList () {
      return this.$store.state.app.tagNavList
    },
    notCacheName () {
      return this.$route.meta && this.$route.meta.notCache ? ['ParentView', this.$route.name] : ['']
    },
    cacheList () {
      return ['ParentView', ...this.tagNavList.length ? this.tagNavList.filter(item => !(item.meta && item.meta.notCache)).map(item => item.name) : []]
    },
    refreshName () {
      return this.$store.state.app.refreshName ? ['ParentView', this.$store.state.app.refreshName] : ['']
    },
    refresh () {
      return this.$store.state.app.refresh
    }
  }
}
</script>
